package com.bango.flex{
	public class BangoConstants{

		public static const SDK_TYPE:Number=10;
		public static const SDK_VERSION:String="1.0.0";
		
		public static const POST_RESPONSE_SUCCESS:String="OK";
		
		public static const ERROR_TAG:String="BANGO_INAPP_ANALYTICS";
		
		public static const VIDEO_PARAMETERNAME:String="BGO_VIDEOTYPE";
		public static const VIDEO_LIVEPARAMETER:String="LIVE";
		public static const VIDEO_ONDEMANDPARAMETER:String="ONDEMAND";
		
		public static const POSTDELAY_SESSIONEND:Number=10000;
		
		public static const UNKNOWN_VERSION:String="Unknown";
		
		public static const PERMISSION_ACCESS_FINE_LOCATION:String="android.permission.ACCESS_FINE_LOCATION";
		public static const PERMISSION_ACCESS_COARSE_LOCATION:String="android.permission.ACCESS_COARSE_LOCATION";
		
		public static const LOCATION_CELL:String="NETWORK";
		public static const LOCATION_ASSISTED:String="ASSISTED";
		public static const LOCATION_GPS:String="GPS";
		public static const LOCATION_MANAGER_MIN_TIME:Number=0;
		public static const LOCATION_MANAGER_MIN_DISTANCE:Number=0;
		
		public static const ERROR_NONE:Number=0;
		public static const ERROR_USER:Number=1;
		public static const ERROR_INTERNAL_CRITICAL:Number=-1;
		public static const ERROR_INTERNAL_WARNING:Number=-2;
		
		public static const SETTING_POST_URL:String="http://bango.net/AppAnalytics/";
		public static const SETTING_USEOFFLINESTORAGE:Boolean=true;
		public static const SETTING_LOGEVENTS:Boolean=true;
		public static const SETTING_LOCATION_FIND:Boolean=true;
		public static const SETTING_PERSIST_DATABASE_CONNECTION:Boolean=true;
		
		public static const DATETIME_FORMAT:String="yyyy-MM-dd'T'HH:mm:ss.SSS";
		
		public static const DATABASE_NAME:String="BangoAnalytics.db";
		public static const DATABASE_VERSION:Number=1;
		public static const DATABASE_TABLE_PLACEHOLDER:String="$TABLENAME";
		public static const DATABASE_TABLE_JOINPLACEHOLDER:String="$TABLEJOINNAME";
		public static const DATABASE_PARAMETER1_PLACEHOLDER:String="$PARAMETER1";
		public static const DATABASE_PARAMETER2_PLACEHOLDER:String="$PARAMETER2";
		public static const DATABASE_PARAMETER3_PLACEHOLDER:String="$PARAMETER3";
		public static const DATABASE_PARAMETER4_PLACEHOLDER:String="$PARAMETER4";
		public static const DATABASE_PARAMETER5_PLACEHOLDER:String="$PARAMETER5";
		
		public static const DATABASE_TABLENAMEPREFIX:String="InApp";
		
		public static const DATABASE_SELECTTABLES:String="SELECT name FROM sqlite_master WHERE type = 'table' AND name LIKE '" + DATABASE_TABLENAMEPREFIX + "%'";
		public static const DATABASE_SELECTPOSTPROFILES:String="SELECT _id as profileId, sdkType, sdkVersion, applicationId, applicationType, applicationChannel, applicationVersion, userId, sessionRestartTime, connectionType, isRoaming, locationSource, locationAltitude, locationLatitude, locationLongitude, locationAccuracy, operator, operatorName, operatorCountryIso, simOperator, brand, device, model, product,os, version, buildId, operatorConnectionType FROM [$TABLENAME] WHERE (locked = 0 AND _id != ?) OR (locked = 1 AND ? != 0)";
		public static const DATABASE_SELECTPOSTEVENTS:String="SELECT _id as eventId, profileId, eventName, eventDetail, eventValue, errorId, eventTime, eventLocalTime, connectionType, operatorConnectionType, errorLevel FROM [$TABLENAME] WHERE eventPosted = 0 AND profileId = ?";
		public static const DATABASE_SELECTPOSTEVENTPARAMETERS:String="SELECT _id as eventParameterId, eventId, eventName, eventValue FROM [$TABLENAME] WHERE eventId = ?";
		
		public static const DATABASE_UPDATEPROFILELOCATION:String="UPDATE [$TABLENAME] SET locationLatitude = $PARAMETER1, locationLongitude = $PARAMETER2, locationAltitude = $PARAMETER3, locationAccuracy = $PARAMETER4, locationSource = '$PARAMETER5' WHERE _id = ";
		public static const DATABASE_UPDATEPROFILEPOSTED:String="UPDATE [$TABLENAME] SET profilePosted = 1 WHERE _id = ";
		public static const DATABASE_UPDATEPROFILELOCK:String="UPDATE [$TABLENAME] SET locked = ? WHERE _id = ";
		public static const DATABASE_UPDATEEVENTPOSTED:String="UPDATE [$TABLENAME] SET eventPosted = 1 WHERE profileId = ";
		
		public static const DATABASE_DELETEPROFILE:String="DELETE FROM [$TABLENAME] WHERE profilePosted = 1 AND _id = ";
		public static const DATABASE_DELETEEVENT:String="DELETE FROM [$TABLENAME] WHERE eventPosted = 1 AND profileId = ";
		public static const DATABASE_DELETEEVENTPARAMETER:String="DELETE FROM [$TABLENAME] WHERE eventId IN (SELECT _id FROM [$TABLEJOINNAME] WHERE eventPosted = 1 AND profileId = $PARAMETER1)";
		
		public static const DATABASE_TABLECREATEPROFILE:String="CREATE TABLE IF NOT EXISTS [$TABLENAME] (_id INTEGER PRIMARY KEY, sdkType INTEGER, sdkVersion TEXT, applicationId TEXT, applicationType TEXT, applicationChannel TEXT, applicationVersion TEXT, userId TEXT, sessionRestartTime INTEGER, connectionType TEXT, isRoaming Boolean, locationSource TEXT, locationAltitude NUMERIC, locationLatitude NUMERIC, locationLongitude NUMERIC, locationAccuracy NUMERIC, operator TEXT, operatorName TEXT, operatorCountryIso TEXT, simOperator TEXT, brand TEXT, device TEXT, model TEXT, product TEXT, os TEXT, version TEXT, buildId TEXT, operatorConnectionType TEXT, profilePosted Boolean, locked Boolean)";
		public static const DATABASE_TABLECREATEEVENT:String="CREATE TABLE IF NOT EXISTS [$TABLENAME] (_id INTEGER PRIMARY KEY, profileId INTEGER, eventName TEXT, eventDetail TEXT, eventValue TEXT, errorId TEXT, eventTime TEXT, eventLocalTime, TEXT, connectionType TEXT, operatorConnectionType TEXT, errorLevel INTEGER, locationLatitude NUMERIC, locationLongitude NUMERIC, locationAccuracy NUMERIC, eventPosted Boolean)";
		public static const DATABASE_TABLECREATEEVENTPARAMETER:String="CREATE TABLE IF NOT EXISTS [$TABLENAME] (_id INTEGER PRIMARY KEY, eventId INTEGER, eventName TEXT, eventValue TEXT)";
		
		public static const DATABASE_CREATEPROFILE:String="INSERT INTO [$TABLENAME] ('sdkType', 'sdkVersion', 'applicationId', 'applicationType', 'applicationChannel', 'applicationVersion', 'userId', 'sessionRestartTime', 'connectionType', 'isRoaming', 'locationSource', 'locationAltitude', 'locationLatitude', 'locationLongitude', 'locationAccuracy', 'operator', 'operatorName', 'operatorCountryIso', 'simOperator', 'brand', 'device', 'model', 'product', 'os', 'version', 'buildId', 'operatorConnectionType', 'profilePosted','locked') VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
		public static const DATABASE_CREATEEVENT:String="INSERT INTO [$TABLENAME] ('profileId', 'eventName', 'eventDetail', 'eventValue', 'errorId', 'eventTime', 'eventLocalTime', 'connectionType', 'operatorConnectionType', 'errorLevel', 'eventPosted')VALUES(?,?,?,?,?,?,?,?,?,?,?)";
		public static const DATABASE_CREATEEVENTPARAMETER:String="INSERT INTO [$TABLENAME] ('eventId', 'eventName', 'eventValue') VALUES (?,?,?)";
		public static const DATABASE_TABLENAMEPROFILE:String="InAppProfiles";
		public static const DATABASE_TABLENAMEEVENT:String="InAppEvents";
		public static const DATABASE_TABLENAMEEVENTPARAMETER:String="InAppEventParameters";
		
		public static const DATABASE_COLUMN_PROFILEID:String="profileId";
		public static const DATABASE_COLUMN_SDKTYPE:String="sdkType";
		public static const DATABASE_COLUMN_SDKVERSION:String="sdkVersion";
		public static const DATABASE_COLUMN_APPLICATIONID:String="applicationId";
		public static const DATABASE_COLUMN_APPLICATIONTYPE:String="applicationType";
		public static const DATABASE_COLUMN_APPLICATIONCHANNEL:String="applicationChannel";
		public static const DATABASE_COLUMN_APPLICATIONVERSION:String="applicationVersion";
		public static const DATABASE_COLUMN_USERID:String="userId";
		public static const DATABASE_COLUMN_SESSIONRESTARTTIME:String="sessionRestartTime";
		public static const DATABASE_COLUMN_CONNECTIONTYPE:String="connectionType";
		public static const DATABASE_COLUMN_ISROAMING:String="isRoaming";
		public static const DATABASE_COLUMN_LOCATIONSOURCE:String="locationSource";
		public static const DATABASE_COLUMN_LOCATIONALTITUDE:String="locationAltitude";
		public static const DATABASE_COLUMN_LOCATIONLATITUDE:String="locationLatitude";
		public static const DATABASE_COLUMN_LOCATIONLONGITUDE:String="locationLongitude";
		public static const DATABASE_COLUMN_LOCATIONACCURACY:String="locationAccuracy";
		public static const DATABASE_COLUMN_OPERATOR:String="operator";
		public static const DATABASE_COLUMN_OPERATORNAME:String="operatorName";
		public static const DATABASE_COLUMN_OPERATORCOUNTRYISO:String="operatorCountryIso";
		public static const DATABASE_COLUMN_SIMOPERATOR:String="simOperator";
		public static const DATABASE_COLUMN_BRAND:String="brand";
		public static const DATABASE_COLUMN_DEVICE:String="device";
		public static const DATABASE_COLUMN_MODEL:String="model";
		public static const DATABASE_COLUMN_PRODUCT:String="product";
		public static const DATABASE_COLUMN_OS:String="os";
		public static const DATABASE_COLUMN_VERSION:String="version";
		public static const DATABASE_COLUMN_BUILDID:String="buildId";
		public static const DATABASE_COLUMN_OPERATORCONNECTIONTYPE:String="operatorConnectionType";
		public static const DATABASE_COLUMN_EVENTID:String="eventId";
		public static const DATABASE_COLUMN_EVENTNAME:String="eventName";
		public static const DATABASE_COLUMN_EVENTDETAIL:String="eventDetail";
		public static const DATABASE_COLUMN_EVENTVALUE:String="eventValue";
		public static const DATABASE_COLUMN_ERRORID:String="errorId";
		public static const DATABASE_COLUMN_EVENTTIME:String="eventTime";
		public static const DATABASE_COLUMN_EVENTLOCALTIME:String="eventLocalTime";
		public static const DATABASE_COLUMN_ERRORLEVEL:String="errorLevel";
		
	}
}